//
//  ViewController.m
//  GLPaintPad
//
//  Created by collegepre on 16/4/20.
//  Copyright © 2016年 collegepre. All rights reserved.
//

#import "ViewController.h"
#import "CPPaintView.h"
//CONSTANTS:

#define kBrightness             1.0
#define kSaturation             0.45

#define kPaletteHeight			30
#define kPaletteSize			5
#define kMinEraseInterval		0.5

// Padding for margins
#define kLeftMargin				10.0
#define kTopMargin				10.0
#define kRightMargin			10.0

@interface ViewController ()<CPPaintViewDrawDelegate>
@property (weak, nonatomic) IBOutlet CPPaintView *paitView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.paitView.backgroundColor = [UIColor clearColor];
    // Defer to the OpenGL view to set the brush color
    [self.paitView setBrushColorWithRed:1 green:1 blue:1 alpha:1];
    
    self.paitView.delegate = self;
}
- (IBAction)eraseBtnCick:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.paitView.isErase = sender.selected;

}
- (IBAction)clearBtnClick:(id)sender {
    [self.paitView clear];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
//    self.paitView.backgroundColor = [UIColor whiteColor];
}

- (void)CPPaintView:(CPPaintView *)paintView drawPoints:(NSArray *)points
{
    NSLog(@"画的点 --%d",points.count);
}

@end
